<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sj" tagdir="/WEB-INF/tags/spring-jquery-tags"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<script type="text/javascript">
	$('.edit-donoraward-link').click(function() {
			loadDiv('content', 'showEditDonoraward.do?id=' + $(this).attr('donorawardId'));
		});
	$(".tablesorter").tablesorter().tablesorterPager({container: $("#pager")});
</script>
<%@ include file="/common/pager.jsp" %>			
<table class="tablesorter">
				<c:choose>
				   <c:when test="${!empty donorawardList}">	
					<thead>
					<c:if test="${messgae!='null'}">
									<tr>
									<th align="center" colspan="13"><font size="4"><c:out value="${message}"></c:out></font></th>
									</tr>
								</c:if>					
						<tr>
						    <!--th><spring:message code="common.select.all"/>&#10;<input type="checkbox" id="check-all"></th-->
							<th><spring:message code="donorawardlist.table.heading.donorAwardNumber" /></th>
							<th><spring:message code="donorawardlist.table.heading.acronym" /></th>
							<th><spring:message code="donorawardlist.table.heading.donor" /></th>
							<th><spring:message code="donorawardlist.table.heading.donorAwardDesc" /></th>
							<th><spring:message code="donorawardlist.table.heading.startDate" /></th>
							<th><spring:message code="donorawardlist.table.heading.endDate" /></th>
							<th><spring:message code="donorawardlist.table.heading.directFunds" /></th>
							<th><spring:message code="donorawardlist.table.heading.indirectFunds" /></th>
							<th><spring:message code="donorawardlist.table.heading.obligatedAmount" /></th>
							<th><spring:message code="donorawardlist.table.heading.donorawardtype" /></th>
							<th><spring:message code="donorawardlist.table.heading.donorawardStatus" /></th>
							<!-- 
							<th><spring:message code="donorawardlist.table.heading.city" /></th>
							<th><spring:message code="donorawardlist.table.heading.state" /></th>
							<th><spring:message code="donorawardlist.table.heading.edit" /></th>
							 -->
						</tr>
					</thead>
					<tbody id="donorgrid">
						 <c:forEach items="${donorawardList}" var="donoraward">
							<!--tr><td><input type="checkbox" name="check_donor" id="check_donor" value="${donoraward.id}"></td-->
								<td><a href="javascript://" class="edit-donoraward-link" donorawardId="${donoraward.id}">${donoraward.donorAwardNumber}</a></td>
								<td>${donoraward.donor.donorAcronym}</td>
								<td>${donoraward.donor.donorName}</td>
								<td>${donoraward.donorAwardDesc}</td>
								<td>${donoraward.formattedStartDate}</td>
								<td>${donoraward.formattedEndDate}</td>
								<td><fmt:formatNumber type="currency" value="${donoraward.directFunds}" pattern="$#,##0;"/></td>
								<td><fmt:formatNumber type="currency" value="${donoraward.indirectFunds}" pattern="$#,##0;"/></td>
								<td><fmt:formatNumber type="currency" value="${donoraward.obligatedAmount}" pattern="$#,##0;"/></td>
								<td>${donoraward.donorawardtype.displayName}</td>
								<td>${donoraward.donorawardstatus.displayName}</td>
								<!-- 
								<td>${donoraward.city}</td>
								<td>${donoraward.state}</td>
								 -->
								<%-- <td><a href="javascript://" class="edit-donoraward-link" donorawardId="${donoraward.id}"><spring:message code="donorawardlist.table.link.edit" /></a></td> --%>
							</tr>
							</c:forEach>
							    <!--tr align="center"><td align="left" colspan="12"><input type="button" class="blue_btn" name="view" value="View Selected Donor Awards" align="center"></td></tr-->
							</c:when>
							<c:otherwise>
							<c:set  var="m" value="${message}"/>
								<c:if test="${! empty m}">
									<thead>
									<tr>
									<th colspan="12"><font size="4"><c:out value="${message}"></c:out></font></th>
									<tr><td colspan="14"> Your query has returned 0 records </td></tr>
									</thead>
								</c:if>	
								<c:if test="${ !empty param.action}">					  
										   <tr><td colspan="12"> Your query has returned 0 records </td></tr>
										 </c:if>  
								</c:otherwise>
						 </c:choose>
					</tbody>
</table>